import java.util.Scanner;

public class test4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] arr = new int[n];
        int max = 0;
        int count = 0;
        int left = 0;
        for(int i = 0; i < arr.length; i++) {
            arr[i] = scanner.nextInt();
            count += arr[i];
            if(i - left + 1 == k) {
                max = Math.max(count,max);
                count -= arr[left];
                left++;
            }
        }
        System.out.println(max);
    }
}
